package com.trsjh.db.domains;
// Generated 2012-1-13 12:55:11 by Hibernate Tools 3.4.0.CR1


import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name="users"
,catalog="myglass"
, uniqueConstraints = @UniqueConstraint(columnNames="loginName") 
		)
public class User  implements java.io.Serializable {


	/**
	 * 
	 */
	private static final long serialVersionUID = 2345822745554098329L;
	@Id @GeneratedValue(strategy=IDENTITY)    
	@Column(name="id", unique=true, nullable=false)
	private Integer id;
	/**
	 * 真实姓名
	 */
	@Column(name="name", nullable=false, length=45)
	private String name;
	/**
	 * 登录名
	 */
	@Column(name="loginName", unique=true, nullable=false, length=20)
	private String loginName;
	/**
	 * 密码
	 */
	@Column(name="password", nullable=false, length=45) 
	private String password;
	/**
	 * 在职状态
	 * y: 在职
	 * n: 离职
	 */
	@Column(name="status", length=1)
	private Character status;
	/**
	 * 拥有的角色
	 */
	@ManyToMany(fetch=FetchType.LAZY)
	@JoinTable(name="users_has_actors", catalog="myglass", joinColumns = { 
			@JoinColumn(name="users_id", nullable=false, updatable=false) }, inverseJoinColumns = { 
			@JoinColumn(name="actors_id", nullable=false, updatable=false) })
	private Set<Actor> actors = new HashSet<Actor>(0);


	public User() {
	}


	public User(String name, String loginName, String password) {
		this.name = name;
		this.loginName = loginName;
		this.password = password;
	}
	public User(String name, String loginName, String password, Character status, Set<Actor> actorses) {
		this.name = name;
		this.loginName = loginName;
		this.password = password;
		this.status = status;
		this.actors = actorses;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public String getLoginName() {
		return this.loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}



	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}


	public Character getStatus() {
		return this.status;
	}

	public void setStatus(Character status) {
		this.status = status;
	}


	public Set<Actor> getActors() {
		return actors;
	}


	public void setActors(Set<Actor> actors) {
		this.actors = actors;
	}


}


